import {request, upload} from '@/utils/request.js';

export const sayHello = () => {
	return request({
		url: '/common/hello'
	})
}



/**
 * 通过id验证有效期
 */
export const checkId = (data) => {
	return request({
		url: '/api/code/check',
		method: 'get',
		data,
	})
}

/**
 * 卡密兑换
 */
export const codeRedeem = (data) => {
	return request({
		url: '/api/code/redeem?code='+data.code+'&userId='+data.userId,
		method: 'POST',
	})
}


/**
 * 上传视频
 */
export const uploadVideo = (data) => {
	data['fileType'] = 'video';
	return upload({
		url: '/common/upload',
		data
	})
}

/**
 * 解析本地视频
 */
export const extractTextWithLocalVideo = (data) => {
	data['fileType'] = 'video';
	data['name'] = 'file';
	return upload({
		url: '/extract/local',
		data,
	})
}

/**
 * 解析视频链接(文字)
 */
export const extractTextWithUrlVideo = (data) => {
	return request({
		url: '/extract/url',
		method: 'POST',
		data,
	})
}

/**
 * 解析视频链接(视频)
 */
export const extractVideoByUrl = (data) => {
	return request({
		url: '/extract/getVideoByurl',
		method: 'POST',
		data,
	})
}

/**
 * 查询任务状态
 */
export const apiGetStatus = (data) => {
	return request({
		url: '/task/status',
		data,
	})
}

/**
 * txt下载
 */
export const getText = (data) => {
	return request({
		url: '/task/getText',
		data,
	})
}

/**
 * 查询历史记录
 */
export const apiGetHistories = (data) => {
	return request({
		url: '/task/myList',
		data,
	})
}

/**
 * 登录
 */
export const apiLogin = (data) => {
	return request({
		url: '/authenticate/wxLogin',
		data,
		method: 'POST',
		showLoading: true,
	})
}

/**
 * 预下单
 */
export const apiPayPrepare = (data) => {
	return request({
		url: '/wechatpay/order/place',
		data,
		method: 'POST',
		showLoading: true,
	});
}

/**
 * 更新头像和昵称
 */
export const updateUserAvatarAndName = (data) => {
	return request({
		url: '/user/updateUserAvatarAndName',
		data,
		method: 'POST',
	})
}

/**
 * 更新头像和昵称
 */
export const getUserInfo = (data) => {
	return request({
		url: '/user/info',
		method: 'GET',
	})
}

/**
 * 上线隐藏字段
 */
export const getDynamicConfig = (data) => {
	return request({
		url: '/user/getDynamicConfig',
		method: 'GET',
	})
}
